home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / lang / sofa.lha / sofa / smalleiffel / sys / gc_lib / linux.c < prev    next >
Text File  |  2000-03-25  |  1KB  |  33 lines

  1. /*
  2. -- This file is  free  software, which  comes  along  with  SmallEiffel. This
  3. -- software  is  distributed  in the hope that it will be useful, but WITHOUT 
  4. -- ANY  WARRANTY;  without  even  the  implied warranty of MERCHANTABILITY or
  5. -- FITNESS  FOR A PARTICULAR PURPOSE. You can modify it as you want, provided
  6. -- this header is kept unaltered, and a notification of the changes is added.
  7. -- You  are  allowed  to  redistribute  it and sell it, alone or as a part of 
  8. -- another product.
  9. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  10. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  11. --                       http://www.loria.fr/SmallEiffel
  12. --
  13. */
  14. /* 
  15.    Stack and Registers traversal for PC Linux with gcc.
  16.    Addresses decrease as the stack grows.
  17.    Registers are saved using SETJMP().
  18.    A little correction of the non-accurate `stack_bottom' seams to 
  19.    be necessary here.
  20. */
  21.  
  22. void mark_stack_and_registers (void) {
  23.   void** max = stack_bottom + 8; /* stack_bottom correction here. */
  24.   void** stack_pointer;
  25.   jmp_buf registers;
  26.  
  27.   (void)setjmp(registers);
  28.   stack_pointer = ((void**)(®isters));
  29.   while (stack_pointer < max) {
  30.     gc_mark(*(stack_pointer++));
  31.   }
  32. }
  33.